/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainFrame.java
 *
 * Created on 2010-9-11, 15:16:09
 */
package dataanalysis.gui.frame;

import dataanalysis.main.MainView;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.JOptionPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import weka.gui.sql.SqlViewerDialog;

/**
 *
 * @author Administrator
 */
public final class MainFrame extends javax.swing.JFrame {

    private final MainView m_manager;
    private final MainTabPanel m_mainTabbedPane1;

    /** Creates new form MainFrame */
    public MainFrame(String title, final MainView manager) throws InterruptedException {
        super(title);
        m_manager = manager;
        m_mainTabbedPane1 = new MainTabPanel();
        initComponents();
        m_mainTabbedPane1.addChangeListener(new ChangeListener() {

            private int nLast = 0;

            public void stateChanged(ChangeEvent e) {
                int n = m_mainTabbedPane1.getTabCount();
                if (n != nLast) {
                    nLast = n;
                    MainFrame.this.updateMenuItemState();
                }
            }
        });
        m_contentPanel.setLayout(new BorderLayout());
        m_contentPanel.add(m_mainTabbedPane1);

        this.setSize(Toolkit.getDefaultToolkit().getScreenSize());
        this.setLocationRelativeTo(null);

        Toolkit tk = Toolkit.getDefaultToolkit();
        Image image = tk.createImage("src\\dataanalysis\\gui\\img\\icon.png");
        this.setIconImage(image);

        setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
        this.setVisible(false);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jToolBar1 = new javax.swing.JToolBar();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jPanel1 = new javax.swing.JPanel();
        m_contentPanel = new javax.swing.JPanel();
        jMenuBar1 = new javax.swing.JMenuBar();
        m_connectDBItem = new javax.swing.JMenu();
        m_openDataItem = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem46 = new javax.swing.JMenuItem();
        m_sabeAllFiles = new javax.swing.JMenuItem();
        jMenuItem42 = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem18 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenuItem9 = new javax.swing.JMenuItem();
        jMenuItem10 = new javax.swing.JMenuItem();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenuItem12 = new javax.swing.JMenuItem();
        jMenu8 = new javax.swing.JMenu();
        jMenuItem13 = new javax.swing.JMenuItem();
        jMenuItem40 = new javax.swing.JMenuItem();
        jMenuItem41 = new javax.swing.JMenuItem();
        jMenuItem14 = new javax.swing.JMenuItem();
        jMenuItem15 = new javax.swing.JMenuItem();
        jMenu9 = new javax.swing.JMenu();
        jMenuItem36 = new javax.swing.JMenuItem();
        jMenuItem37 = new javax.swing.JMenuItem();
        jMenuItem38 = new javax.swing.JMenuItem();
        jMenuItem39 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        m_dataMenuItem = new javax.swing.JCheckBoxMenuItem();
        jMenu14 = new javax.swing.JMenu();
        m_oriDataViewMenuItem = new javax.swing.JRadioButtonMenuItem();
        m_preDataViewMenuItem = new javax.swing.JRadioButtonMenuItem();
        m_editDataViewMenuItem = new javax.swing.JRadioButtonMenuItem();
        m_selectDataViewMenuItem = new javax.swing.JRadioButtonMenuItem();
        m_variableMenuItem = new javax.swing.JCheckBoxMenuItem();
        m_resultMenuItem = new javax.swing.JCheckBoxMenuItem();
        m_statisticMenuItem = new javax.swing.JCheckBoxMenuItem();
        jMenu10 = new javax.swing.JMenu();
        jMenuItem48 = new javax.swing.JMenuItem();
        jMenuItem49 = new javax.swing.JMenuItem();
        jMenuItem50 = new javax.swing.JMenuItem();
        jMenuItem51 = new javax.swing.JMenuItem();
        jMenuItem52 = new javax.swing.JMenuItem();
        m_programmMenuItem = new javax.swing.JCheckBoxMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem20 = new javax.swing.JMenuItem();
        jMenuItem21 = new javax.swing.JMenuItem();
        jMenuItem22 = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();
        jMenu13 = new javax.swing.JMenu();
        m_oriDataMenuItem = new javax.swing.JRadioButtonMenuItem();
        m_editDataMenuItem = new javax.swing.JRadioButtonMenuItem();
        m_preDataMenuItem = new javax.swing.JRadioButtonMenuItem();
        m_selectDataMenuItem = new javax.swing.JRadioButtonMenuItem();
        jMenu12 = new javax.swing.JMenu();
        jMenuItem23 = new javax.swing.JMenuItem();
        jMenuItem24 = new javax.swing.JMenuItem();
        jMenuItem53 = new javax.swing.JMenuItem();
        jMenuItem54 = new javax.swing.JMenuItem();
        jMenuItem25 = new javax.swing.JMenuItem();
        jMenuItem17 = new javax.swing.JMenuItem();
        jMenuItem28 = new javax.swing.JMenuItem();
        jMenuItem26 = new javax.swing.JMenuItem();
        jMenuItem29 = new javax.swing.JMenuItem();
        jMenuItem27 = new javax.swing.JMenuItem();
        jMenuItem16 = new javax.swing.JMenuItem();
        jMenu6 = new javax.swing.JMenu();
        jMenuItem30 = new javax.swing.JMenuItem();
        jMenuItem31 = new javax.swing.JMenuItem();
        jMenuItem32 = new javax.swing.JMenuItem();
        jMenuItem44 = new javax.swing.JMenuItem();
        jMenuItem45 = new javax.swing.JMenuItem();
        jMenu7 = new javax.swing.JMenu();
        jMenuItem33 = new javax.swing.JMenuItem();
        jMenuItem34 = new javax.swing.JMenuItem();
        jMenuItem35 = new javax.swing.JMenuItem();
        jMenuItem43 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jToolBar1.setRollover(true);

        jPanel2.setPreferredSize(new java.awt.Dimension(543, 25));

        jLabel1.setFont(new java.awt.Font("宋体", 0, 14));
        jLabel1.setText("A1:");
        jLabel1.setPreferredSize(new java.awt.Dimension(18, 21));

        jTextField1.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        jTextField1.setPreferredSize(new java.awt.Dimension(72, 25));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 415, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel1.setPreferredSize(new java.awt.Dimension(543, 28));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 539, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 24, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout m_contentPanelLayout = new javax.swing.GroupLayout(m_contentPanel);
        m_contentPanel.setLayout(m_contentPanelLayout);
        m_contentPanelLayout.setHorizontalGroup(
            m_contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 543, Short.MAX_VALUE)
        );
        m_contentPanelLayout.setVerticalGroup(
            m_contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 286, Short.MAX_VALUE)
        );

        m_connectDBItem.setText("文件(F)");

        m_openDataItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        m_openDataItem.setText("打开数据");
        m_openDataItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_openDataItemActionPerformed(evt);
            }
        });
        m_connectDBItem.add(m_openDataItem);

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem1.setText("连接数据库");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        m_connectDBItem.add(jMenuItem1);

        jMenuItem46.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem46.setText("保存数据");
        m_connectDBItem.add(jMenuItem46);

        m_sabeAllFiles.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        m_sabeAllFiles.setText("保存所有文件");
        m_sabeAllFiles.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_sabeAllFilesActionPerformed(evt);
            }
        });
        m_connectDBItem.add(m_sabeAllFiles);

        jMenuItem42.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem42.setText("保存数据模板");
        m_connectDBItem.add(jMenuItem42);

        jMenu1.setText("导出数据");

        jMenuItem2.setText("原始维度");
        jMenu1.add(jMenuItem2);

        jMenuItem3.setText("变量筛选");
        jMenu1.add(jMenuItem3);

        jMenuItem4.setText("特征选择");
        jMenu1.add(jMenuItem4);

        m_connectDBItem.add(jMenu1);

        jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem5.setText("导出预测模型");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        m_connectDBItem.add(jMenuItem5);

        jMenuItem18.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem18.setText("保存模型参数");
        jMenuItem18.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem18ActionPerformed(evt);
            }
        });
        m_connectDBItem.add(jMenuItem18);

        jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem6.setText("退出");
        m_connectDBItem.add(jMenuItem6);

        jMenuBar1.add(m_connectDBItem);

        jMenu2.setText("编辑(E)");

        jMenuItem7.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem7.setText("撤销");
        jMenu2.add(jMenuItem7);

        jMenuItem8.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Y, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem8.setText("重做");
        jMenu2.add(jMenuItem8);

        jMenuItem9.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem9.setText("复制");
        jMenu2.add(jMenuItem9);

        jMenuItem10.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem10.setText("粘贴");
        jMenu2.add(jMenuItem10);

        jMenuItem11.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem11.setText("查找");
        jMenu2.add(jMenuItem11);

        jMenuItem12.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem12.setText("替换");
        jMenu2.add(jMenuItem12);

        jMenu8.setText("表格");

        jMenuItem13.setText("清除内容");
        jMenu8.add(jMenuItem13);

        jMenuItem40.setText("插入行");
        jMenu8.add(jMenuItem40);

        jMenuItem41.setText("插入列");
        jMenu8.add(jMenuItem41);

        jMenuItem14.setText("删除行");
        jMenu8.add(jMenuItem14);

        jMenuItem15.setText("删除列");
        jMenu8.add(jMenuItem15);

        jMenu2.add(jMenu8);

        jMenu9.setText("变量筛选");

        jMenuItem36.setText("全选");
        jMenu9.add(jMenuItem36);

        jMenuItem37.setText("全不选");
        jMenu9.add(jMenuItem37);

        jMenuItem38.setText("反选");
        jMenu9.add(jMenuItem38);

        jMenuItem39.setText("特征选择");
        jMenu9.add(jMenuItem39);

        jMenu2.add(jMenu9);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("查看(V)");

        m_dataMenuItem.setText("数据视图");
        m_dataMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_dataMenuItemActionPerformed(evt);
            }
        });
        jMenu3.add(m_dataMenuItem);

        jMenu14.setText("数据视图");

        buttonGroup2.add(m_oriDataViewMenuItem);
        m_oriDataViewMenuItem.setSelected(true);
        m_oriDataViewMenuItem.setText("原始数据");
        m_oriDataViewMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_oriDataViewMenuItemActionPerformed(evt);
            }
        });
        jMenu14.add(m_oriDataViewMenuItem);

        buttonGroup2.add(m_preDataViewMenuItem);
        m_preDataViewMenuItem.setText("预处理数据");
        m_preDataViewMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_preDataViewMenuItemActionPerformed(evt);
            }
        });
        jMenu14.add(m_preDataViewMenuItem);

        buttonGroup2.add(m_editDataViewMenuItem);
        m_editDataViewMenuItem.setText("编辑数据");
        m_editDataViewMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_editDataViewMenuItemActionPerformed(evt);
            }
        });
        jMenu14.add(m_editDataViewMenuItem);

        buttonGroup2.add(m_selectDataViewMenuItem);
        m_selectDataViewMenuItem.setText("特征选择数据");
        m_selectDataViewMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_selectDataViewMenuItemActionPerformed(evt);
            }
        });
        jMenu14.add(m_selectDataViewMenuItem);

        jMenu3.add(jMenu14);

        m_variableMenuItem.setText("变量视图");
        m_variableMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_variableMenuItemActionPerformed(evt);
            }
        });
        jMenu3.add(m_variableMenuItem);

        m_resultMenuItem.setText("输出面板");
        m_resultMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_resultMenuItemActionPerformed(evt);
            }
        });
        jMenu3.add(m_resultMenuItem);

        m_statisticMenuItem.setText("统计面板");
        m_statisticMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_statisticMenuItemActionPerformed(evt);
            }
        });
        jMenu3.add(m_statisticMenuItem);

        jMenu10.setText("应用窗口");

        jMenuItem48.setText("图像窗口");
        jMenu10.add(jMenuItem48);

        jMenuItem49.setText("声音窗口");
        jMenu10.add(jMenuItem49);

        jMenuItem50.setText("股票窗口");
        jMenu10.add(jMenuItem50);

        jMenuItem51.setText("文本窗口");
        jMenu10.add(jMenuItem51);

        jMenuItem52.setText("网页窗口");
        jMenu10.add(jMenuItem52);

        jMenu3.add(jMenu10);

        m_programmMenuItem.setText("程序编辑器");
        jMenu3.add(m_programmMenuItem);

        jMenuBar1.add(jMenu3);

        jMenu4.setText("图表(G)");

        jMenuItem20.setText("频数分布");
        jMenuItem20.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem20ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem20);

        jMenuItem21.setText("相关度量");
        jMenu4.add(jMenuItem21);

        jMenuItem22.setText("数据空间");
        jMenuItem22.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem22ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem22);

        jMenuBar1.add(jMenu4);

        jMenu5.setText("程序(P)");

        jMenu13.setText("数据源");

        buttonGroup1.add(m_oriDataMenuItem);
        m_oriDataMenuItem.setSelected(true);
        m_oriDataMenuItem.setText("原始数据");
        m_oriDataMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_oriDataMenuItemActionPerformed(evt);
            }
        });
        jMenu13.add(m_oriDataMenuItem);

        buttonGroup1.add(m_editDataMenuItem);
        m_editDataMenuItem.setText("编辑数据");
        m_editDataMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_editDataMenuItemActionPerformed(evt);
            }
        });
        jMenu13.add(m_editDataMenuItem);

        buttonGroup1.add(m_preDataMenuItem);
        m_preDataMenuItem.setText("预处理数据");
        m_preDataMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_preDataMenuItemActionPerformed(evt);
            }
        });
        jMenu13.add(m_preDataMenuItem);

        buttonGroup1.add(m_selectDataMenuItem);
        m_selectDataMenuItem.setText("特征选择数据");
        m_selectDataMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_selectDataMenuItemActionPerformed(evt);
            }
        });
        jMenu13.add(m_selectDataMenuItem);

        jMenu5.add(jMenu13);

        jMenu12.setText("参数设置");

        jMenuItem23.setText("预处理");
        jMenuItem23.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem23ActionPerformed(evt);
            }
        });
        jMenu12.add(jMenuItem23);

        jMenuItem24.setText("半监督特征选择");
        jMenuItem24.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem24ActionPerformed(evt);
            }
        });
        jMenu12.add(jMenuItem24);

        jMenuItem53.setText("评价方法");
        jMenuItem53.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem53ActionPerformed(evt);
            }
        });
        jMenu12.add(jMenuItem53);

        jMenuItem54.setText("搜索策略");
        jMenuItem54.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem54ActionPerformed(evt);
            }
        });
        jMenu12.add(jMenuItem54);

        jMenuItem25.setText("分类器");
        jMenuItem25.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem25ActionPerformed(evt);
            }
        });
        jMenu12.add(jMenuItem25);

        jMenuItem17.setText("更多选项");
        jMenuItem17.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem17ActionPerformed(evt);
            }
        });
        jMenu12.add(jMenuItem17);

        jMenu5.add(jMenu12);

        jMenuItem28.setText("预测模型");
        jMenuItem28.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem28ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem28);

        jMenuItem26.setText("流程设置");
        jMenuItem26.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem26ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem26);

        jMenuItem29.setText("半监督");
        jMenu5.add(jMenuItem29);

        jMenuItem27.setText("添加方法");
        jMenuItem27.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem27ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem27);

        jMenuItem16.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem16.setText("开始执行");
        jMenuItem16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem16ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem16);

        jMenuBar1.add(jMenu5);

        jMenu6.setText("应用(A)");

        jMenuItem30.setText("图像");
        jMenu6.add(jMenuItem30);

        jMenuItem31.setText("声音");
        jMenu6.add(jMenuItem31);

        jMenuItem32.setText("股票");
        jMenu6.add(jMenuItem32);

        jMenuItem44.setText("文本");
        jMenu6.add(jMenuItem44);

        jMenuItem45.setText("网页");
        jMenu6.add(jMenuItem45);

        jMenuBar1.add(jMenu6);

        jMenu7.setText("帮助(H)");

        jMenuItem33.setText("使用说明");
        jMenu7.add(jMenuItem33);

        jMenuItem34.setText("版权声明");
        jMenu7.add(jMenuItem34);

        jMenuItem35.setText("数据共享");
        jMenu7.add(jMenuItem35);

        jMenuItem43.setText("算法共享");
        jMenu7.add(jMenuItem43);

        jMenuBar1.add(jMenu7);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 543, Short.MAX_VALUE)
            .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(m_contentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(m_contentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void m_openDataItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_openDataItemActionPerformed
        m_manager.OpenNewDataFile();
    }//GEN-LAST:event_m_openDataItemActionPerformed

    @SuppressWarnings("empty-statement")
    private void jMenuItem23ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem23ActionPerformed
        m_manager.showPreDlg();
    }//GEN-LAST:event_jMenuItem23ActionPerformed

    @SuppressWarnings("empty-statement")
    private void jMenuItem24ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem24ActionPerformed
        m_manager.showSemiASDlg();
    }//GEN-LAST:event_jMenuItem24ActionPerformed

    @SuppressWarnings("empty-statement")
    private void jMenuItem25ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem25ActionPerformed
        m_manager.showClsDlg();
    }//GEN-LAST:event_jMenuItem25ActionPerformed

    private void jMenuItem26ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem26ActionPerformed
        m_manager.showFlowDlg();
    }//GEN-LAST:event_jMenuItem26ActionPerformed

    private void jMenuItem53ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem53ActionPerformed
        m_manager.showEvlDlg();
    }//GEN-LAST:event_jMenuItem53ActionPerformed

    private void jMenuItem54ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem54ActionPerformed
        m_manager.showSchDlg();
    }//GEN-LAST:event_jMenuItem54ActionPerformed

    private void m_dataMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_dataMenuItemActionPerformed
        m_manager.openDataView(m_dataMenuItem.isSelected());
    }//GEN-LAST:event_m_dataMenuItemActionPerformed

    private void m_variableMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_variableMenuItemActionPerformed
        m_manager.openVariableView(m_variableMenuItem.isSelected());
    }//GEN-LAST:event_m_variableMenuItemActionPerformed

    private void m_resultMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_resultMenuItemActionPerformed
        m_manager.openResultPanel(m_resultMenuItem.isSelected());
    }//GEN-LAST:event_m_resultMenuItemActionPerformed

    private void m_oriDataMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_oriDataMenuItemActionPerformed
        m_manager.setCurDataByIndex(0);
    }//GEN-LAST:event_m_oriDataMenuItemActionPerformed

    private void m_editDataMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_editDataMenuItemActionPerformed
        m_manager.setCurDataByIndex(1);
    }//GEN-LAST:event_m_editDataMenuItemActionPerformed

    private void m_preDataMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_preDataMenuItemActionPerformed
        m_manager.setCurDataByIndex(2);
    }//GEN-LAST:event_m_preDataMenuItemActionPerformed

    private void m_selectDataMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_selectDataMenuItemActionPerformed
        m_manager.setCurDataByIndex(3);
    }//GEN-LAST:event_m_selectDataMenuItemActionPerformed

    private void jMenuItem16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem16ActionPerformed
        m_manager.runDataProcessThread();
    }//GEN-LAST:event_jMenuItem16ActionPerformed

    private void m_oriDataViewMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_oriDataViewMenuItemActionPerformed
        m_manager.setDataTableViewByIndex(0);
    }//GEN-LAST:event_m_oriDataViewMenuItemActionPerformed

    private void m_editDataViewMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_editDataViewMenuItemActionPerformed
        m_manager.setDataTableViewByIndex(2);
    }//GEN-LAST:event_m_editDataViewMenuItemActionPerformed

    private void m_preDataViewMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_preDataViewMenuItemActionPerformed
        m_manager.setDataTableViewByIndex(1);
    }//GEN-LAST:event_m_preDataViewMenuItemActionPerformed

    private void m_selectDataViewMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_selectDataViewMenuItemActionPerformed
        m_manager.setDataTableViewByIndex(3);
    }//GEN-LAST:event_m_selectDataViewMenuItemActionPerformed

    private void m_sabeAllFilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_sabeAllFilesActionPerformed
        m_manager.saveAllFiles();
    }//GEN-LAST:event_m_sabeAllFilesActionPerformed

    private void jMenuItem17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem17ActionPerformed
        m_manager.showMoreOptionsDlg();
    }//GEN-LAST:event_jMenuItem17ActionPerformed

    private void jMenuItem28ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem28ActionPerformed
        m_manager.showPredictDlg();
    }//GEN-LAST:event_jMenuItem28ActionPerformed

    private void jMenuItem22ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem22ActionPerformed
        m_manager.showDataSpacePanel();
    }//GEN-LAST:event_jMenuItem22ActionPerformed

    private void jMenuItem20ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem20ActionPerformed
        m_manager.showFrequencyPanel();
    }//GEN-LAST:event_jMenuItem20ActionPerformed

    private void m_statisticMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_statisticMenuItemActionPerformed
        m_manager.showStatisticPanel(m_statisticMenuItem.isSelected());
    }//GEN-LAST:event_m_statisticMenuItemActionPerformed

    private void jMenuItem27ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem27ActionPerformed
        m_manager.showAddMethodPanel();
    }//GEN-LAST:event_jMenuItem27ActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
                SqlViewerDialog dialog = new SqlViewerDialog(null);
        dialog.setLocationRelativeTo(this);
        dialog.setVisible(true);

        if (dialog.getReturnValue() == JOptionPane.OK_OPTION)
          m_manager.connectDatabase(dialog.getURL(), dialog.getUser(),
                              dialog.getPassword(), dialog.getQuery());
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        m_manager.exportModel();
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jMenuItem18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem18ActionPerformed
        m_manager.savePredictTxt();
    }//GEN-LAST:event_jMenuItem18ActionPerformed
//
//    /**
//     * @param args the command line arguments
//     */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//
//            public void run() {
//                try {
//                    new MainFrame("DataAnalysis", null).setVisible(true);
//                } catch (InterruptedException ex) {
//                    Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
//                }
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu10;
    private javax.swing.JMenu jMenu12;
    private javax.swing.JMenu jMenu13;
    private javax.swing.JMenu jMenu14;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenu jMenu7;
    private javax.swing.JMenu jMenu8;
    private javax.swing.JMenu jMenu9;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem13;
    private javax.swing.JMenuItem jMenuItem14;
    private javax.swing.JMenuItem jMenuItem15;
    private javax.swing.JMenuItem jMenuItem16;
    private javax.swing.JMenuItem jMenuItem17;
    private javax.swing.JMenuItem jMenuItem18;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem20;
    private javax.swing.JMenuItem jMenuItem21;
    private javax.swing.JMenuItem jMenuItem22;
    private javax.swing.JMenuItem jMenuItem23;
    private javax.swing.JMenuItem jMenuItem24;
    private javax.swing.JMenuItem jMenuItem25;
    private javax.swing.JMenuItem jMenuItem26;
    private javax.swing.JMenuItem jMenuItem27;
    private javax.swing.JMenuItem jMenuItem28;
    private javax.swing.JMenuItem jMenuItem29;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem30;
    private javax.swing.JMenuItem jMenuItem31;
    private javax.swing.JMenuItem jMenuItem32;
    private javax.swing.JMenuItem jMenuItem33;
    private javax.swing.JMenuItem jMenuItem34;
    private javax.swing.JMenuItem jMenuItem35;
    private javax.swing.JMenuItem jMenuItem36;
    private javax.swing.JMenuItem jMenuItem37;
    private javax.swing.JMenuItem jMenuItem38;
    private javax.swing.JMenuItem jMenuItem39;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem40;
    private javax.swing.JMenuItem jMenuItem41;
    private javax.swing.JMenuItem jMenuItem42;
    private javax.swing.JMenuItem jMenuItem43;
    private javax.swing.JMenuItem jMenuItem44;
    private javax.swing.JMenuItem jMenuItem45;
    private javax.swing.JMenuItem jMenuItem46;
    private javax.swing.JMenuItem jMenuItem48;
    private javax.swing.JMenuItem jMenuItem49;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem50;
    private javax.swing.JMenuItem jMenuItem51;
    private javax.swing.JMenuItem jMenuItem52;
    private javax.swing.JMenuItem jMenuItem53;
    private javax.swing.JMenuItem jMenuItem54;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JMenu m_connectDBItem;
    private javax.swing.JPanel m_contentPanel;
    private javax.swing.JCheckBoxMenuItem m_dataMenuItem;
    private javax.swing.JRadioButtonMenuItem m_editDataMenuItem;
    private javax.swing.JRadioButtonMenuItem m_editDataViewMenuItem;
    private javax.swing.JMenuItem m_openDataItem;
    private javax.swing.JRadioButtonMenuItem m_oriDataMenuItem;
    private javax.swing.JRadioButtonMenuItem m_oriDataViewMenuItem;
    private javax.swing.JRadioButtonMenuItem m_preDataMenuItem;
    private javax.swing.JRadioButtonMenuItem m_preDataViewMenuItem;
    private javax.swing.JCheckBoxMenuItem m_programmMenuItem;
    private javax.swing.JCheckBoxMenuItem m_resultMenuItem;
    private javax.swing.JMenuItem m_sabeAllFiles;
    private javax.swing.JRadioButtonMenuItem m_selectDataMenuItem;
    private javax.swing.JRadioButtonMenuItem m_selectDataViewMenuItem;
    private javax.swing.JCheckBoxMenuItem m_statisticMenuItem;
    private javax.swing.JCheckBoxMenuItem m_variableMenuItem;
    // End of variables declaration//GEN-END:variables

    public void openView(String title, final Component comp) {
        int index = m_mainTabbedPane1.indexOfComponent(comp);
        if (index == -1) {  //未添加该组件
            m_mainTabbedPane1.addTab(title, comp);
        }
        m_mainTabbedPane1.setSelectedComponent(comp);
    }

    public void setView(Component comp) {
        if (!hasComponent(comp)) {
            return;
        }
        m_mainTabbedPane1.setSelectedComponent(comp);
    }

    public void closeView(final Component comp) {
        if (hasComponent(comp)) {
            m_mainTabbedPane1.remove(comp);
        }
    }

    private void updateMenuItemState() {
        m_dataMenuItem.setSelected(m_manager.isShowDataView());
        m_variableMenuItem.setSelected(m_manager.isShowVariableView());
        m_resultMenuItem.setSelected(m_manager.isShowResultView());
        m_statisticMenuItem.setSelected(m_manager.isShowStatisticView());
        m_programmMenuItem.setSelected(m_manager.isShowProgrammView());
    }

    public boolean hasComponent(final Component comp) {
        int index = m_mainTabbedPane1.indexOfComponent(comp);
        if (index == -1) {  //未添加该组件
            return false;
        }
        return true;
    }

    public void initDataMenuItem() {
        m_oriDataMenuItem.setSelected(true);
        m_oriDataViewMenuItem.setSelected(true);
    }
}
